Hi All,
How do I create a project using multiple source files?
I understand the concept of including header files but I don't really know how to combine other source files.
Here is what I tried
main.c
Code:
#include<stdio.h>
#include"other.h"
int main (void)
{
printf("%d\n", getnumber());
return 0;
}
other.h
Code:
#include "other.h"
int getfavoritenumber(void)
{
return 3;
}
other.c
Code:
#ifndef _OTHER_H_
#define _OTHER_H_
int getnumber(void);
#endif
compiler gives error
undefined reference to `getnumber'
collect2.exe: error: ld returned 1 exit status
What's wrong with files ?